﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mysoft.QuickCode.Log
{
    /// <summary>
    /// 可视化日志输出，输出的日志可以通过DebugView查看
    /// </summary>
    public static class LogViewer
    {
        /// <summary>
        /// 输出日志
        /// </summary>
        /// <param name="lpszOutputString">Debug日志内容。为了方便用DebugView工具进行过滤查询。建议采用格式：前缀+Debug内容（如：VE=系统异常）</param>
        [System.Runtime.InteropServices.DllImport("kernel32")]
        private extern static void OutputDebugString(string lpszOutputString);

        /// <summary>
        /// 输出调试日志
        /// </summary>
        /// <param name="logName"></param>
        /// <param name="message"></param>
        public static void Debug(string logName, string message)
        {
            OutputDebugString(string.Format("[DBV][DEBUG][{0}][{1}]", logName, message));
        }
    }
}
